// class SelectGirl {
//   constructor(private grils: string[]) {}
//   getGril(index: number): string {
//     return this.grils[index]
//   }
// }

interface Name {
  name: string
}

class Person {
  constructor(public name: string) {}
}

class SelectGirl<T extends Name> {
  constructor(private grils: T[]) {}
  getGril(index: number): string {
    return this.grils[index].name
  }
}

// class SelectGirl<T extends string | number> {
//   constructor(private grils: T[]) {}
//   getGril(index: number): string {
//     return this.grils[index].name
//   }
// }

// const selectGirl = new SelectGirl<Person>([
//   new Person('111'),
//   new Person('222'),
// ])
const selectGirl = new SelectGirl<Name>([{ name: '2' }, { name: '2' }])
// const selectGirl = new SelectGirl<number>([1, 3, 5])
console.log(selectGirl)

console.log(selectGirl.getGril(1))
